package com.woniuxy.yoga.gateway.config;

import org.springframework.stereotype.Component;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;

import java.util.Arrays;
import java.util.List;

@Component
public class SwaggerResourceConfig implements SwaggerResourcesProvider {
    @Override
    public List<SwaggerResource> get() {
        return Arrays.asList(
                create("管理员服务", "/admin/v2/api-docs"),
                create("商家服务","/business/v2/api-docs"),
                create("教练服务", "/coach/v2/api-docs"),
                create("课程服务", "/course/v2/api-docs"),
                create("评价服务", "/evaluate/v2/api-docs"),
                create("公告服务", "/notice/v2/api-docs"),
                create("订单服务", "/order/v2/api-docs"),
                create("产品服务", "/product/v2/api-docs"),
                create("流程服务", "/progress/v2/api-docs"),
                create("用户服务", "/user/v2/api-docs")
        );
    }
    private SwaggerResource create(String name, String url) {
        SwaggerResource swaggerResource = new SwaggerResource();
        swaggerResource.setName(name);
        swaggerResource.setLocation(url);
        swaggerResource.setSwaggerVersion("2.0");
        return swaggerResource;
    }

}
